package com.base.project.main

import androidx.activity.viewModels
import com.base.project.R
import com.base.project.databinding.MainSceneBinding
import com.gyf.immersionbar.ktx.immersionBar
import com.lxj.xpopup.core.BasePopupView
import com.lxj.xpopup.interfaces.SimpleCallback
import com.orange.common.base.BaseActivity
import com.orange.common.ktx.intervalTimeDefault
import com.orange.common.ktx.onClick
import com.orange.common.popup.LoadingPopup


/**
 * Created by Orange on 2022/12/15 21:53.
 */
class MainActivity : BaseActivity<MainSceneBinding>() {

    override val viewModel: MainViewModel by viewModels()

    override fun getLayoutId() = R.layout.main_scene

    override fun initView() {
        immersionBar {
            statusBarDarkFont(false) //设置状态栏字体颜色
            titleBar(binding.space) // 添加paddingTop状态栏高度
        }
        // 防止连续点击 默认间隔500ms
        binding.space.onClick {
            //具体操作
        }
        // 设置间隔1000ms
        binding.space.onClick(1000) {
        }
        // 设置全局间隔 2000ms
        intervalTimeDefault = 2000

        //单个弹窗
        LoadingPopup().show()
        //连续弹窗,dismiss 后自动显示下一个
        LoadingPopup().addShow()
        LoadingPopup().addShow()
        //额外设置 这一步也可以放在内部initView时执行
        LoadingPopup().build {
            dismissOnBackPressed(false) // 按返回键是否关闭弹窗
            dismissOnTouchOutside(false) // 点击外部是否关闭弹窗
            hasShadowBg(false)
            setPopupCallback(object : SimpleCallback() {
                override fun onDismiss(popupView: BasePopupView?) {
                }
            })
        }.addShow()
    }

    override fun initData() {

    }
}